package com.zxd.socket;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

/**
 * ClassName:MyService
 * Package:com.zxd.socket
 *
 * @Date:2023/9/28 20:28
 * @Author:zxde
 */
public class MyService {
    public static void main(String[] args) throws IOException {
        DatagramSocket datagramSocket = new DatagramSocket(6666);
        byte[] buffer = new byte[1024*64];
        DatagramPacket datagramPacket = new DatagramPacket(buffer, buffer.length);
        datagramSocket.receive(datagramPacket);
        String dataString = new String(datagramPacket.getData(),0,datagramPacket.getLength());
        System.out.println(dataString);
    }
}
